<template>
	<div class="app" v-if="isSettingShow">
		<div class="conteng"></div>
		<div class="settting_content">
			<div class="company_info">
				<image :src="user.mchLogo" style="width: 50px;height: 50px;border-radius: 50px;" />
				<text class="compan_name">{{user.mchName}}</text>
			</div>
			<div class="setting_function">
				
				<div class="function_item" @click="toOpenScaner">
					<div class="icon">
						<text class="title2" style="color: darkorange;">&#xe637;</text>
					</div>
					<text class="function_name">扫一扫</text>
				</div>
				<!-- <div class="function_item">
					<div class="icon">
						<text class="title2" style="color:firebrick">&#xe676;</text>
					</div>
					<text class="function_name">分享</text>
				</div> -->
				<div class="function_item" @click="systemClick">
					<div class="icon">
						<text class="title2">&#xe628;</text>
					</div>
					<text class="function_name">设置</text>
				</div>
			</div>
			<div class="cancel_content" @click="cancelClick"><text style="font-size: 30px;">取消</text></div>
		</div>
	</div>
</template>
<script>
		import {scaner} from'../../api/scan.js'
	import {getInfo} from '../../api/mch.js'
	 
	export default {
		name: '',
		data() {
			return {
				isSettingShow:false,
				 user:{},
			}
		},
		created() { // 在实例创建完成后被立即调用
		this.loadInfo()
		this.initIconFont()
		},
		methods: {
			loadInfo(){
				getInfo(this.getGlobalData().token).then(res=>{
					  this.user = res.data;
					console.info( this.user)
				})
			},
			settingShow(){
				this.isSettingShow=true
			},
			toOpenScaner() {
				this.isSettingShow=false
				eeui.openScaner({}, (res) => {
					switch (res.status) {
						
						case "success":
							scaner({
								q:res.text
								
							}).then(res=>{
								console.log(res)
								if(res.type=='success'){
									eeui.openPage({
									    pageType: 'auto	',
									    url: res.data.url,
									    statusBarType: 'immersion',
									    statusBarStyle:false
									})
								}
							}).catch(error=>{
								eeui.toast(error);
							})
							break;
			
						case "error":
							eeui.toast("识别失败");
							break;
					}
				});
			},
			cancelClick(){
				this.isSettingShow=false
			},
			systemClick() {
				var _this = this
				this.isSettingShow=false
				if (this.checkPermission(['parameter.query']) == false) {
					eeui.alert('您没有修改店铺权限', function() {});
					return
				}
				if (this.getGlobalData().token == null) {
							_this.$emit('getUserInfo')
					return;
			
				}
				eeui.openPage({
					url: 'root://pages/member/system/system.js',
					statusBarType: 'immersion',
					statusBarStyle: false
				}, result => {
					if (result.status == 'stop') {
						var times=new Date().getTime()
						// _this.getUserInfo()
						_this.$emit('getUserInfo',times)
						
					}
				});
			},
		},
		components: {},
	}
</script>

<style scoped>
	.app{
		position: fixed;
		top: 0;
		left: 0;
		right: 0;
		bottom: 0;
		background-color: rgba(0, 0, 0, 0.3);
		z-index: 999;
	}
	.conteng{
		flex: 1;
		background-color: rgba(0,0,0,0.3);
		/* position: fixed; */
		 /* width: 750px; */
	}
	.settting_content{
		background-color: rgba(244,244,244,1);
		bottom: 0;
		border-top-left-radius: 20px;
		border-top-right-radius: 20px;
		width: 750px;
		/* height: 400px; */
		position: fixed;
		padding-top: 20px;
		
		box-sizing: border-box;
	}
	.company_info{
		width: 730px;
		display: flex;
		padding-left: 30px;
		flex-direction: row;
		border-bottom-width: 0.5px;
		border-style: solid;
		border-color: rgba(0,0,0,0.1);
		padding-bottom: 20px;
		align-items: center;
	}
	.compan_name{
		font-size: 28px;
		font-weight: 600;
		margin-left: 20px;
	}
	.setting_function{
		display: flex;
		flex-direction: row;
		
		padding-left: 30px;
		padding-top: 20px;
	}
	
	.title2 {
		font-size: 50px;
		font-family: iconfont2;
		/* color: rgba(26, 26, 30, 1); */
		color: seagreen;
		/* opacity: 0.5; */
		/* margin-right: 5px; */
	}
	.function_item{
		margin-right: 20px;
		display: flex;
		justify-content: center;
		align-items: center;
	}
	.icon{
		height: 100px;
		width: 100px;
		border-radius: 20px;
		background-color: white;
		display: flex;
		justify-content: center;
		align-items: center;
	}
	.function_name{
		font-size: 25px;
		margin-top: 20px;
	}
	.cancel_content{
		width: 750px;
		background-color: white;
		display: flex;
		margin-top: 30px;
		justify-content: center;
		align-items: center;
		/* position: absolute; */
		/* bottom: 0; */
		height: 100px;
	}
</style>
